home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / a_man / cat7 / route.z / route
Encoding:
Text File  |  2002-10-03  |  11.8 KB  |  265 lines

  1.  
  2.  
  3.  
  4. RRRROOOOUUUUTTTTEEEE((((7777PPPP))))                                                            RRRROOOOUUUUTTTTEEEE((((7777PPPP))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      route - kernel packet forwarding database
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ssssoooocccckkkkeeeetttt....hhhh>>>>
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<nnnneeeetttt////iiiiffff....hhhh>>>>
  14.      ####iiiinnnncccclllluuuuddddeeee <<<<nnnneeeetttt////rrrroooouuuutttteeee....hhhh>>>>
  15.      iiiinnnntttt ssssoooocccckkkkeeeetttt((((PPPPFFFF____RRRROOOOUUUUTTTTEEEE,,,, SSSSOOOOCCCCKKKK____RRRRAAAAWWWW,,,, ffffaaaammmmiiiillllyyyy))));;;;
  16.  
  17. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.      The system provides some packet routing facilities.  The kernel maintains
  19.      a routing information database, which is used in selecting the
  20.      appropriate network interface when transmitting packets.
  21.  
  22.      A user process (or possibly multiple co-operating processes) maintains
  23.      this database by sending messages over a special kind of socket.  This
  24.      supplants fixed size _i_o_c_t_l(2)'s used in earlier releases.  Routing table
  25.      changes may only be carried out by the super user.
  26.  
  27.      The operating system may spontaneously emit routing messages in response
  28.      to external events, such as receipt of a re-direct, or failure to locate
  29.      a suitable route for a request.  The message types are described in
  30.      greater detail below.
  31.  
  32.      Routing database entries come in two flavors: for a specific host, or for
  33.      all hosts on a generic subnetwork (as specified by a bit mask and value
  34.      under the mask.  The effect of wildcard or default route may be achieved
  35.      by using a mask of all zeros, and there may be hierarchical routes.
  36.  
  37.      When the system is booted and addresses are assigned to the network
  38.      interfaces, each protocol family installs a routing table entry for each
  39.      interface when it is ready for traffic.  Normally the protocol specifies
  40.      the route through each interface as a ``direct'' connection to the
  41.      destination host or network.  If the route is direct, the transport layer
  42.      of a protocol family usually requests the packet be sent to the same host
  43.      specified in the packet.  Otherwise, the interface is requested to
  44.      address the packet to the gateway listed in the routing entry ( _i._e. the
  45.      packet is forwarded).
  46.  
  47.      When routing a packet, the kernel will attempt to find the most specific
  48.      route matching the destination.  (If there are two different mask and
  49.      value-under-the-mask pairs that match, the more specific is the one with
  50.      more bits in the mask.  A route to a host is regarded as being supplied
  51.      with a mask of as many ones as there are bits in the destination).  If no
  52.      entry is found, the destination is declared to be unreachable, and a
  53.      routing-miss message is generated if there are any listers on the routing
  54.      control socket described below.
  55.  
  56.      A wildcard routing entry is specified with a zero destination address
  57.      value, and a mask of all zeroes.  Wildcard routes will be used when the
  58.      system fails to find other routes matching the destination.  The
  59.      combination of wildcard routes and routing redirects can provide an
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRROOOOUUUUTTTTEEEE((((7777PPPP))))                                                            RRRROOOOUUUUTTTTEEEE((((7777PPPP))))
  71.  
  72.  
  73.  
  74.      economical mechanism for routing traffic.
  75.  
  76.      One opens the channel for passing routing control messages by using the
  77.      socket call shown in the synopsis above:
  78.  
  79.      The _f_a_m_i_l_y parameter may be _A_F__U_N_S_P_E_C which will provide routing
  80.      information for all address families, or can be restricted to a specific
  81.      address family by specifying which one is desired.  There can be more
  82.      than one routing socket open per system.
  83.  
  84.      Messages are formed by a header followed by a small number of sockaddrs
  85.      interpreted by position.  An example of a message with three addresses
  86.      might be a redirect:  Destination, Gateway, and Author of the redirect.
  87.      The interpretation of which addresses are present is given by a bit mask
  88.      within the header, and the sequence is least significant to most
  89.      significant bit within the vector.
  90.  
  91.      Any messages sent to the kernel are returned, and copies are sent to all
  92.      interested listeners.  The kernel will provide the process id. for the
  93.      sender, and the sender may use an additional sequence field to
  94.      distinguish between outstanding messages.  However, message replies may
  95.      be lost when kernel buffers are exhausted.
  96.  
  97.      The kernel may reject certain messages, and will indicate this by filling
  98.      in the _r_t_m__e_r_r_n_o field.  The routing code returns _E_E_X_I_S_T if requested to
  99.      duplicate an existing entry, _E_S_R_C_H if requested to delete a non-existent
  100.      entry, or _E_N_O_B_U_F_S if insufficient resources were available to install a
  101.      new route.  In the current implementation, all routing processes run
  102.      locally, and the values for _r_t_m__e_r_r_n_o are available through the normal
  103.      _e_r_r_n_o mechanism, even if the routing reply message is lost.
  104.  
  105.      A process may avoid the expense of reading replies to its own messages by
  106.      issuing a _s_e_t_s_o_c_k_o_p_t(2) call indicating that the _S_O__U_S_E_L_O_O_P_B_A_C_K option at
  107.      the _S_O_L__S_O_C_K_E_T level is to be turned off.  A process may ignore all
  108.      messages from the routing socket by doing a _s_h_u_t_d_o_w_n(2) system call for
  109.      further input.
  110.  
  111.      If a route is in use when it is deleted, the routing entry will be marked
  112.      down and removed from the routing table, but the resources associated
  113.      with it will not be reclaimed until all references to it are released.
  114.      User processes can obtain information about the routing entry to a
  115.      specific destination by using a _R_T_M__G_E_T message, or by reading the
  116.      /_d_e_v/_k_m_e_m device.
  117.  
  118.      Messages include:
  119.  
  120.           #define   RTM_ADD        0x1    /* Add Route */
  121.           #define   RTM_DELETE     0x2    /* Delete Route */
  122.           #define   RTM_CHANGE     0x3    /* Change Metrics, Flags, or Gateway */
  123.           #define   RTM_GET        0x4    /* Report Information */
  124.           #define   RTM_LOOSING    0x5    /* Kernel Suspects Partitioning */
  125.           #define   RTM_REDIRECT   0x6    /* Told to use different route */
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRROOOOUUUUTTTTEEEE((((7777PPPP))))                                                            RRRROOOOUUUUTTTTEEEE((((7777PPPP))))
  137.  
  138.  
  139.  
  140.           #define   RTM_MISS       0x7    /* Lookup failed on this address */
  141.           #define   RTM_RESOLVE    0xb    /* request to resolve dst to LL addr */
  142.  
  143.  
  144.      A message header consists of:
  145.  
  146.           struct rt_msghdr {
  147.               u_short rmt_msglen;  /* to skip over non-understood messages */
  148.               u_char  rtm_version; /* future binary compatibility */
  149.               u_char  rtm_type;    /* message type */
  150.               u_short rmt_index;   /* index for associated ifp */
  151.               pid_t   rmt_pid;     /* identify sender */
  152.               __uint32_t     rtm_addrs;   /* bitmask identifying sockaddrs in msg */
  153.               int     rtm_seq;     /* for sender to identify action */
  154.               int     rtm_errno;   /* why failed */
  155.               int     rtm_flags;   /* flags, incl kern & message, e.g. DONE */
  156.               int     rtm_use;     /* from rtentry */
  157.               u_long  rtm_inits;   /* which values we are initializing */
  158.               struct  rt_metrics rtm_rmx;    /* metrics themselves */
  159.           };
  160.  
  161.  
  162.      where
  163.  
  164.           struct rt_metrics {
  165.               u_long rmx_locks;     /* Kernel must leave these values alone */
  166.               u_long rmx_mtu;       /* MTU for this path */
  167.               u_long rmx_hopcount;  /* max hops expected */
  168.               u_long rmx_expire;    /* lifetime for route, e.g. redirect */
  169.               u_long rmx_recvpipe;  /* inbound delay-bandwidth product */
  170.               u_long rmx_sendpipe;  /* outbound delay-bandwidth product */
  171.               u_long rmx_ssthresh;  /* outbound gateway buffer limit */
  172.               u_long rmx_rtt;       /* estimated round trip time */
  173.               u_long rmx_rttvar;    /* estimated rtt variance */
  174.           };
  175.  
  176.  
  177.      Flags include the values:
  178.  
  179.           #define   RTF_UP        0x1       /* route usable */
  180.           #define   RTF_GATEWAY   0x2       /* destination is a gateway */
  181.           #define   RTF_HOST      0x4       /* host entry (net otherwise) */
  182.           #define   RTF_REJECT    0x8       /* host or net unreachable */
  183.           #define   RTF_DYNAMIC   0x10      /* created dynamically (by redirect) */
  184.           #define   RTF_MODIFIED  0x20      /* modified dynamically (by redirect) */
  185.           #define   RTF_DONE      0x40      /* message confirmed */
  186.           #define   RTF_MASK      0x80      /* subnet mask present */
  187.           #define   RTF_CLONING   0x100     /* generate new routes on use */
  188.           #define   RTF_XRESOLVE  0x200     /* external daemon resolves name */
  189.           #define   RTF_LLINFO    0x400     /* generated by ARP or ESIS */
  190.           #define   RTF_STATIC    0x800     /* manually added */
  191.           #define   RTF_BLACKHOLE 0x1000    /* just discard pkts (during updates) */
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. RRRROOOOUUUUTTTTEEEE((((7777PPPP))))                                                            RRRROOOOUUUUTTTTEEEE((((7777PPPP))))
  203.  
  204.  
  205.  
  206.           #define   RTF_PROTO2    0x4000    /* protocol specific routing flag #1 */
  207.           #define   RTF_PROTO1    0x8000    /* protocol specific routing flag #2 */
  208.           #define   RTF_CKSUM     0x10000   /* TCP/UDP checksumming done on this route */
  209.  
  210.  
  211.      Specifiers for metric values in rmx_locks and rtm_inits are:
  212.  
  213.           #define   RTV_SSTHRESH  0x1    /* init or lock _ssthresh */
  214.           #define   RTV_RPIPE     0x2    /* init or lock _recvpipe */
  215.           #define   RTV_SPIPE     0x4    /* init or lock _sendpipe */
  216.           #define   RTV_HOPCOUNT  0x8    /* init or lock _hopcount */
  217.           #define   RTV_RTT       0x10   /* init or lock _rtt */
  218.           #define   RTV_RTTVAR    0x20   /* init or lock _rttvar */
  219.           #define   RTV_MTU       0x40   /* init or lock _mtu */
  220.  
  221.  
  222.      Specifiers for which addresses are present in the messages are:
  223.  
  224.           #define RTA_DST       0x1    /* destination sockaddr present */
  225.           #define RTA_GATEWAY   0x2    /* gateway sockaddr present */
  226.           #define RTA_NETMASK   0x4    /* netmask sockaddr present */
  227.           #define RTA_GENMASK   0x8    /* cloning mask sockaddr present */
  228.           #define RTA_IFP       0x10   /* interface name sockaddr present */
  229.           #define RTA_IFA       0x20   /* interface addr sockaddr present */
  230.           #define RTA_AUTHOR    0x40   /* sockaddr for author of redirect */
  231.  
  232.  
  233. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  234.      ip(7p), netintro(7p)
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.